<template>
	<view>
		<navbar :title="`当前城市-${city}`" :back="true" color="#fff" leftIconColor="#fff"></navbar>
		<citySelect ref="popupRef" @back_city="back_city" :statusBarHeight='rect.bottom'/>
	</view>
</template>

<script>
	import navbar from '@/components/baseNavbar.vue'
	import citySelect from '@/components/linzq-citySelect/linzq-citySelect.vue';
	export default{
		components:{
			citySelect,
			navbar
		},
		data(){
			return{
				region:{
					name:'',
					id:'',
					children:[]
				},
				city:'广州市',
				rect:''
			}
		},
		onReady(){
		   this.rect = uni.getMenuButtonBoundingClientRect()
		
		},
		methods:{
			 back_city(e) {
				 if (e !== 'no') {
					 this.region.name = e.cityName
					 this.region.id = Number(e.id)
					 e.children.forEach(item=>{
						 let s = {}
						 s.text = item.name
						 s.value = item.id
						 this.region.children.push(s)
					 })
					 console.log('cy',e);
					 if(this.region!=''){
						 uni.reLaunch({
						 	url:'/pages/index/index?adress='+ JSON.stringify(this.region)
						 })
					 }
					 this.$refs.popupRef.close(); 
				  } else { 
					 this.$refs.popupRef.close(); 
				 }
			 }
		}
	}
</script>

<style>
</style>